package com.leyou.item.pojo.api;

import com.leyou.common.pojo.PageResult;
import com.leyou.item.pojo.Brand;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("brand")
public interface BrandApi {

    @GetMapping("page")
    public ResponseEntity<PageResult<Brand>> queryBrandByPage(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "rows", defaultValue = "5") Integer rows,
            @RequestParam(value = "sortBy", required = false) String sortBy,
            @RequestParam(value = "desc", defaultValue = "false") Boolean desc,
            @RequestParam(value = "key", required = false) String key
    );

    @PostMapping
    public ResponseEntity<Brand> saveBrand(Brand brand, @RequestParam("cids") List<Long> cids);

    @PutMapping
    public ResponseEntity<String> updateBrand(Brand brand, @RequestParam("cids") List<Long> cids);

    @DeleteMapping("{id}")
    public ResponseEntity<String> deleteByID(@PathVariable("id") Long id);

    @GetMapping("cid/{cid}")
    public ResponseEntity<List<Brand>> queryBrandByCid(@PathVariable("cid") Long cid);

    @GetMapping("bid/{bid}")
    public Brand queryBrandByBid(@PathVariable("bid") Long bid);

    @GetMapping("list")
    public List<Brand> queryBrandListByIds(@RequestParam("ids") List<Long> ids);
}
